import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: () => import('../components/Layout.vue'),
      children:[
        {
          path: '/home',
          name: 'Home',
          component: () => import('../views/home.vue')
        },
        {
          path:'/user',
          name:'User',
          component:() => import('../views/user/index.vue')
        },
        {
          path:'/product',
          name:'Product',
          component:() => import('../views/product/index.vue')
        },
        {
          path:'/category',
          name:'Category',
          component:() => import('../views/category/index.vue')
        },
        {
          path:'/order',
          name:'Order',
          component:() => import('../views/order/index.vue')
        }
        ,
        {
          path:'/check',
          name:'Check',
          component:() => import('../views/order/check.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/login/login.vue')
    }
  ]
})

export default router
